package top.tsyz.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "OperationLog 实体类")
public class OperationLog {

    @ApiModelProperty(value = "日志ID")
    private Long id;

    @ApiModelProperty(value = "管理员ID")
    private Long adminId;

    @ApiModelProperty(value = "操作模块")
    @NotBlank(message = "操作模块不能为空")
    @Size(max = 100, message = "操作模块长度不能超过100个字符")
    private String module;

    @ApiModelProperty(value = "操作类型")
    @NotBlank(message = "操作类型不能为空")
    @Size(max = 100, message = "操作类型长度不能超过100个字符")
    private String operation;

    @ApiModelProperty(value = "请求URI")
    @Size(max = 255, message = "请求URI长度不能超过255个字符")
    private String requestUri;

    @ApiModelProperty(value = "请求方式")
    @Size(max = 10, message = "请求方式长度不能超过10个字符")
    private String requestMethod;

    @ApiModelProperty(value = "请求参数")
    @Size(max = 65535, message = "请求参数长度不能超过65535个字符")
    private String requestParams;

    @ApiModelProperty(value = "响应结果")
    @Size(max = 65535, message = "响应结果长度不能超过65535个字符")
    private String responseResult;

    @ApiModelProperty(value = "IP地址")
    @Size(max = 64, message = "IP地址长度不能超过64个字符")
    private String ip;

    @ApiModelProperty(value = "用户代理")
    @Size(max = 500, message = "用户代理长度不能超过500个字符")
    private String userAgent;

    @ApiModelProperty(value = "执行时长(毫秒)")
    private Long executionTime;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "创建人")
    @Size(max = 50, message = "创建人长度不能超过50个字符")
    private String createUser;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "更新人")
    @Size(max = 50, message = "更新人长度不能超过50个字符")
    private String updateUser;

    @ApiModelProperty(value = "逻辑删除 0-未删除 1-已删除")
    private Boolean isDeleted;

}
